import { getUserInfo } from "../../utils/localStorage/userInfo";
import { Navigate } from "react-router-dom";

import { useNavigate } from "react-router-dom";

const AuthRoute = ({ children }) => {

    const userInfo = getUserInfo()

    if (userInfo) {
        return <>
            {children}
        </>
    } else {
        return <Navigate to='/'  replace={true} />
    }
}

export default AuthRoute